<?php
/**
 * 基层控制器
 * @author GL
 * @data 2018.8.23
 */

namespace App\Http\Controllers;

use App\Servers\Ajax;

class BaseController extends Controller
{
    protected $user_id = 0;

    //初始化信息
    public function __construct()
    {
        $this->user_id = session()->has('user_id') ? session('user_id') : 0;
    }


    protected function _initialize() {

    }

    /**
     * 成功返回
     */
    public static function success($apiName, $data = [])
    {
        Ajax::success($apiName, $data);
    }

    /**
     * 失败返回
     */
    public static function error($apiName, $errMsg = '')
    {
        Ajax::error($apiName, $errMsg);
    }
}
